﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Petroleum.Tool;
using Petroleum.DB.Model;
using HZH_Controls.Controls;
using Petroleum.Model;

namespace Petroleum.UC
{
    public partial class Step4WellBoreQuality : UserControl
    {
        FormMain main = new FormMain();
        List<Casing> casingList = Session.CasingProgram.CasingList;
        public Step4WellBoreQuality(FormMain main)
        {
            InitializeComponent();
            this.main = main;

            //井眼轨迹靶点
            //List<KeyValuePair<string, string>> spudCom = casingList.Select(m =>
            //    new KeyValuePair<string, string>(m.BitSize, m.SpudNo)
            //).ToList();

            //cmdCasing.Source = spudCom;
            //cmdCasing.SelectedIndex = 0;
            //套管信息

        }
        public Step4WellBoreQuality()
        {
            InitializeComponent();
        }


        private void dgvCementing_Load(object sender, EventArgs e)
        {
            List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "SpudNo", HeadText = "Spud No", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "HoleSequence", HeadText = "Hole Sequence", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "HoleDepth", HeadText = "HoleDepth", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "BitSize", HeadText = "Bit Size (mm)", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "CasingSize", HeadText = "Casing size (mm)", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "TratumofCasingShoeSet", HeadText = "StratumofCasingShoeSet", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "CasingInterval", HeadText = "CasingInterval", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "DescriptionOfDesign", HeadText = "DescriptionOfDesign", Width = 300, WidthType = SizeType.Absolute });

            this.dgvCementing.Columns = lstCulumns;
            this.dgvCementing.DataSource = Session.CasingProgram.CasingList;
        }

        private void dgvWellBore_Load(object sender, EventArgs e)
        {
            List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "MD", HeadText = "MD", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "CL", HeadText = "CL(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Inc", HeadText = "Inc(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Azi", HeadText = "Azi(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "TVD", HeadText = "TVD(m)", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "NS", HeadText = "NS(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "EW", HeadText = "EW(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "VSec", HeadText = "V.Sec(m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Dogleg", HeadText = "Dogleg (°/30m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "MapN", HeadText = "Map N (m)", Width = 200, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "MapE", HeadText = "Map E (m)", Width = 200, WidthType = SizeType.Absolute});
            lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "IsTarget", HeadText = "Lithology", Width = 200, WidthType = SizeType.Absolute});

            this.dgvWellBore.Columns = lstCulumns;
            this.dgvWellBore.DataSource = Session.WellTrajectory.TrajectoryList;
        }
        private void btnDown_BtnClick(object sender, EventArgs e)
        {
            main.AddControl(new Step5(main));
        }

        private void Step4WellBoreQuality_Load(object sender, EventArgs e)
        {

        }

        private void btnUp_BtnClick(object sender, EventArgs e)
        {
            main.AddControl(new Step4(main));

        }
    }
}
